<%@ page session="true" buffer="16kb" import="java.sql.*,java.util.*,java.text.*"%>
<%@ page contentType="text/html; charset=utf-8" %>
<%
response.setDateHeader("Expires", 0); // date in the past
response.addHeader("Cache-Control", "no-store, no-cache, must-revalidate"); // HTTP/1.1 
response.addHeader("Cache-Control", "post-check=0, pre-check=0"); 
response.addHeader("Pragma", "no-cache"); // HTTP/1.0 
%>
<% Locale locale = Locale.getDefault();
locale = new Locale("zh","CN"); 
response.setLocale(locale);%>
<% session.setMaxInactiveInterval(30*60); %>
<% 
String login = (String) session.getAttribute("project1_status");
if (login == null || !login.equals("login")) {
response.sendRedirect("login.jsp");
response.flushBuffer(); 
return; 
}%>
<%int ewAllowAdmin = 16; 
int ewCurSec = 31;%>
<%@ include file="db.jsp" %>
<%@ include file="jspmkrfn.jsp" %>
<%
String tmpfld = null;
String escapeString = "\\\\'";
String key = request.getParameter("key");
if (key == null || key.length() == 0) { response.sendRedirect("order_infolist.jsp");}

// Get action
String a = request.getParameter("a");
if (a == null || a.length() == 0) {
	a = "I";	// Display with input box
}
String x_ORDER_NUM = "";
String x_COMPANY_NUM = "";
String x_PRODUCTION_NUM = "";
String x_PRICE = "";
String x_QUANTITY = "";
Object x_ORDER_TIME = null;
String x_ORDER_STATUS = "";
String x_GROSS = "";

// Open Connection to the database
try{
	Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
	ResultSet rs = null;
	if (a.equals("I")) {// Get a record to display
		String tkey = "'" + key.replaceAll("'",escapeString) + "'";
		String strsql = "SELECT * FROM `order_info` WHERE `ORDER_NUM`=" + tkey;
		rs = stmt.executeQuery(strsql);
		if (!rs.next()) {
			out.clear();
			response.sendRedirect("order_infolist.jsp");
		}else{
			rs.first();
		}

		// Get field values
		// ORDER_NUM

		if (rs.getString("ORDER_NUM") != null){
			x_ORDER_NUM = rs.getString("ORDER_NUM");
		}else{
			x_ORDER_NUM = "";
		}

		// COMPANY_NUM
		if (rs.getString("COMPANY_NUM") != null){
			x_COMPANY_NUM = rs.getString("COMPANY_NUM");
		}else{
			x_COMPANY_NUM = "";
		}

		// PRODUCTION_NUM
		if (rs.getString("PRODUCTION_NUM") != null){
			x_PRODUCTION_NUM = rs.getString("PRODUCTION_NUM");
		}else{
			x_PRODUCTION_NUM = "";
		}

		// PRICE
		x_PRICE = String.valueOf(rs.getDouble("PRICE"));

		// QUANTITY
		x_QUANTITY = String.valueOf(rs.getDouble("QUANTITY"));

		// ORDER_TIME
		if (rs.getTimestamp("ORDER_TIME") != null){
			x_ORDER_TIME = rs.getTimestamp("ORDER_TIME");
		}else{
			x_ORDER_TIME = "";
		}

		// ORDER_STATUS
		if (rs.getString("ORDER_STATUS") != null){
			x_ORDER_STATUS = rs.getString("ORDER_STATUS");
		}else{
			x_ORDER_STATUS = "";
		}

		// GROSS
		x_GROSS = String.valueOf(rs.getDouble("GROSS"));
	}
%>
<%@ include file="header.jsp" %>
<div class="content">
	<div class="search">
		<p><span class="jspmaker table_name">订单信息表元组<br></span></p>
		<a class="jspmaker back" href="order_infolist.jsp">返回</a>
	</div>
	<form>
		<table border="0" cellspacing="1" cellpadding="4" bgcolor="#CCCCCC">
			<tr>
				<td bgcolor="#594FBF"><span class="jspmaker" style="color: #FFFFFF;">订单编号</span>&nbsp;</td>
				<td bgcolor="#F5F5F5"><span class="jspmaker"><% out.print(x_ORDER_NUM); %></span>&nbsp;</td>
			</tr>
			<tr>
				<td bgcolor="#594FBF"><span class="jspmaker" style="color: #FFFFFF;">企业编号</span>&nbsp;</td>
				<td bgcolor="#F5F5F5"><span class="jspmaker"><% out.print(x_COMPANY_NUM); %></span>&nbsp;</td>
			</tr>
			<tr>
				<td bgcolor="#594FBF"><span class="jspmaker" style="color: #FFFFFF;">商品编号</span>&nbsp;</td>
				<td bgcolor="#F5F5F5"><span class="jspmaker"><% out.print(x_PRODUCTION_NUM); %></span>&nbsp;</td>
			</tr>
			<tr>
				<td bgcolor="#594FBF"><span class="jspmaker" style="color: #FFFFFF;">价格</span>&nbsp;</td>
				<td bgcolor="#F5F5F5"><span class="jspmaker"><% out.print(x_PRICE); %></span>&nbsp;</td>
			</tr>
			<tr>
				<td bgcolor="#594FBF"><span class="jspmaker" style="color: #FFFFFF;">订货量</span>&nbsp;</td>
				<td bgcolor="#F5F5F5"><span class="jspmaker"><% out.print(x_QUANTITY); %></span>&nbsp;</td>
			</tr>
			<tr>
				<td bgcolor="#594FBF"><span class="jspmaker" style="color: #FFFFFF;">订货时间</span>&nbsp;</td>
				<td bgcolor="#F5F5F5"><span class="jspmaker"><% out.print(EW_FormatDateTime(x_ORDER_TIME,5,locale)); %></span>&nbsp;</td>
			</tr>
			<tr>
				<td bgcolor="#594FBF"><span class="jspmaker" style="color: #FFFFFF;">订单状态</span>&nbsp;</td>
				<td bgcolor="#F5F5F5"><span class="jspmaker"><% out.print(x_ORDER_STATUS); %></span>&nbsp;</td>
			</tr>
			<tr>
				<td bgcolor="#594FBF"><span class="jspmaker" style="color: #FFFFFF;">订单总金额</span>&nbsp;</td>
				<td bgcolor="#F5F5F5"><span class="jspmaker"><% out.print(x_GROSS); %></span>&nbsp;</td>
			</tr>
		</table>
	</form>
</div>
<p>
<%
	rs.close();
	rs = null;
	stmt.close();
	stmt = null;
	conn.close();
	conn = null;
}catch(SQLException ex){
	out.println(ex.toString());
}
%>
<%@ include file="footer.jsp" %>
